/*
 * Copyright (c)  2017
 * All rights reserved.
 * OrderEntity.java 2017-09-17 下午2:59
 */

package com.ueboot.weishop.entity.order;

import com.ueboot.weishop.entity.IDEntity;
import com.ueboot.weishop.entity.customer.CustomerInfoEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.Date;

/**
 * 描述:订单发票信息
 *
 * @author yangkui create on 2017-09-17 下午2:59.
 * @since 1.0
 */
@Data
@NoArgsConstructor
@Entity(name = "WS_ORDER_INVOICE")
public class OrderInvoiceEntity extends IDEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.TABLE, generator = "WS_ORDER_INVOICE")
    @GenericGenerator(name = "WS_ORDER_INVOICE", strategy = "enhanced-table", parameters = {
            @org.hibernate.annotations.Parameter(name = "table_name", value = "WS_TABLE_SEQUENCE"),
            @org.hibernate.annotations.Parameter(name = "segment_value", value = "WS_ORDER_INVOICE"),
            @org.hibernate.annotations.Parameter(name = "optimizer", value = "pooled")})
    @Column(name = "ID", columnDefinition = "INT(20) COMMENT 'id主键'", length = 20)
    private Long id;


    /**
     * 所属订单
     */
    @ManyToOne
    @JoinColumn(name="ORDER_ID",columnDefinition = "INT(20) COMMENT '所属订单'")
    private OrderEntity order;

    /**
     * 发票类型 个人 公司
     */
    @Column(name = "INVOICE_TYPE",columnDefinition = "VARCHAR(40) COMMENT '发票类型 个人 公司'",length = 40)
    private String invoiceType;
    /**
     * 户名
     */
    @Column(name = "TITLE_NAME",columnDefinition = "VARCHAR(200) COMMENT '户名'",length = 200)
    private String titleName;
    /**
     * 开户银行
     */
    @Column(name = "DEPOSIT_BANK",columnDefinition = "VARCHAR(200) COMMENT '开户银行'",length = 200)
    private String depositBank;
    /**
     * 公司地址
     */
    @Column(name = "COMPANY_ADDRESS",columnDefinition = "VARCHAR(200) COMMENT '公司地址'",length = 200)
    private String companyAddress;
    /**
     * 账号
     */
    @Column(name = "ACCOUNT_NO",columnDefinition = "VARCHAR(200) COMMENT '账号'",length = 200)
    private String accountNo;
    /**
     * 税号
     */
    @Column(name = "TAX_FILE_NUMBER",columnDefinition = "VARCHAR(200) COMMENT '税号'",length = 200)
    private String taxFileNumber;

    /**
     * 开票备注
     */
    @Column(name = "REMARK",columnDefinition = "VARCHAR(200) COMMENT '开票备注'",length = 200)
    private String remark;

    /**
     * 开票日期
     */
    @Column(name = "MAKE_DATE",columnDefinition = "DATE COMMENT '开票日期'")
    private Date makeDate;

    /**
     * 发票号
     */
    @Column(name = "INVOICE_NO",columnDefinition = "VARCHAR(40) COMMENT '发票号'",length = 40)
    private String invoiceNo;

    /**
     * 快递公司
     */
    @Column(name = "EXPRESS_NAME",columnDefinition = "VARCHAR(40) COMMENT '快递公司'",length = 40)
    private String expressName;

    /**
     * 快递单号
     */
    @Column(name = "EXPRESS_NO",columnDefinition = "VARCHAR(40) COMMENT '快递单号'",length = 40)
    private String expressNo;

    /**
     * 所属客户（冗余）
     */
    @ManyToOne
    @JoinColumn(name="CUSTOMER_ID",columnDefinition = "INT(20) COMMENT '所属客户（冗余）'")
    private CustomerInfoEntity customer;

}
